package ogl;


import static org.lwjgl.opengl.GL11.GL_QUADS;
import static org.lwjgl.opengl.GL11.glBegin;
import static org.lwjgl.opengl.GL11.glColor3f;
import static org.lwjgl.opengl.GL11.glEnd;
import static org.lwjgl.opengl.GL11.glPopMatrix;
import static org.lwjgl.opengl.GL11.glPushMatrix;
import static org.lwjgl.opengl.GL11.glRotatef;
import static org.lwjgl.opengl.GL11.glTranslatef;
import static org.lwjgl.opengl.GL11.glVertex2f;

public class Draw {
	
	public static void rect(float x, float y, float width, float height, float red, float green, float blue){
		rect(x,y,width,height,0,red,green,blue);
		}
	
	private static void rect(float x, float y, float width, float height, float rot, float red, float green, float blue){

		glPushMatrix();//sa creeze o noua matrice

		glTranslatef(x, y, 0);//Translateaza(muta) ceea ce desenam
		glRotatef(rot, 0, 0, 1);//parametri - (unghi, x, y, z), punem doar z-ul pe 1...

		/*
		 Tot ce desenam in ogl trebuie pus intr-un bloc glBegin-glEnd; 
		 glBegin are ca parametru ceea ce desenam (QUADS - pentru patrulatere)
		 */
		glBegin(GL_QUADS);

		{
			glColor3f(red,green,blue);
			glVertex2f(0,0);
			glVertex2f(0, height);
			glVertex2f(width, height);
			glVertex2f(width, 0);
		}
		glEnd();

		glPopMatrix();//sa stearga o matrice

		/*
		 * Cream si stergem matricea respectiva deoarece
		 * in cazul in care vrem sa desenam 2 forme cu aceleasi coordonate
		 * de inceput sa se poata suprapuna		
		 */
	}
}
